<div ng-controller="customerLevelController">
    <ol class="breadcrumb pull-right">
        <li><a ui-sref="app.home">汇票线</a></li>
        <li><a ui-sref="app.customer">客户管理</a></li>
        <li class="active">客户级别管理</li>
    </ol>

    <h1 class="page-header"><i class="fa fa-lg text-success fa-cog"></i> 客户级别管理</h1>

    <div class="row">
        <div class="col-md-12">
            <div class="panel panel-inverse">
                <div class="panel-heading">
                    <div class="panel-heading-btn">
                        <a href="javascript:;" class="btn btn-xs btn-icon btn-circle btn-default" data-click="panel-expand"><i class="fa fa-expand"></i></a>
                        <a href="javascript:;" class="btn btn-xs btn-icon btn-circle btn-success" data-click="panel-reload"><i class="fa fa-repeat"></i></a>
                        <a href="javascript:;" class="btn btn-xs btn-icon btn-circle btn-warning" data-click="panel-collapse"><i class="fa fa-minus"></i></a>
                        <a href="javascript:;" class="btn btn-xs btn-icon btn-circle btn-danger" data-click="panel-remove"><i class="fa fa-times"></i></a>
                    </div>
                    <h4 class="panel-title">客户级别管理</h4>
                </div>
                <div class="panel-body">
                    <div class="form-inline filter-option">
                        <div class="row">
                            <div class="col-md-12">
                                <div class="pull-right">
                                    <!--<select ng-model="filter.customer_level_name" ng-options="item.id as item.customer_level_name for item in customer_levels" class="form-control input-sm">
                                        <option value="">客户级别名称...</option>
                                    </select>-->
                                    <input type="text" ng-model="filter.keyword" class="form-control input-sm" placeholder="关键词" />
                                    <button class="btn btn-sm btn-info" ng-click="reflash()"><i class="fa fa-search"></i> 筛选</button>
                                    <button class="btn btn-sm btn-success" ng-click="edit()"><i class="fa fa-plus-circle"></i> 新增</button>
                                </div>
                            </div>
                        </div>
                    </div>
                    <table id="data-table" ng-table="tableParams" template-pagination="template/pagination.html" class="table table-striped table-bordered table-hover table-condensed">
                        <tr ng-repeat="item in $data">
                            <td data-title="'序号'" width="10%" class="text-center">{{ first + $index }}</td>
                            <td data-title="'上级客户ID'" class="text-left">{{ item.previous_customer_level_id }}</td>
                            <td data-title="'上级客户级别名'" class="text-left">{{ item.previous_customer_level_name }}</td>
                            <td data-title="'客户级别名称'" class="text-left">{{ item.customer_level_name }}</td>
                            <td data-title="'贴现率'" class="text-left">{{ item.discount_rate }}</td>
                            <td data-title="'描述'" class="text-left">{{ item.description }}</td>
                            <td class="text-center width-100 text-nowrap">
                                <button class="btn btn-success btn-xs" ng-click="edit(item)"><i class="fa fa-edit"></i> 编辑</button>
                                <button class="btn btn-success btn-xs" ng-click="remove(item)"><i class="fa fa-trash-o"></i> 删除</button>
                            </td>
                        </tr>
                    </table>
                </div>
                <div class="modal fade" id="modal-edit">
                    <div class="modal-dialog">
                        <div class="modal-content">
                            <ng-form name="editForm" novalidate>
                                <div class="modal-header">
                                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                                    <h4 class="modal-title"><i class="fa fa-lg fa-edit text-success"></i>客户信息</h4>
                                </div>
                                <div class="modal-body">
                                    <div class="form-horizontal form-inline">
                                        <div class="form-group width-full" ng-class="{ 'has-error':editForm.previous_customer_level_id.$invalid && editForm.previous_customer_level_id.dirty }">
                                            <label class="col-md-3 control-label"><font color="red">*</font> 上级客户ID</label>
                                            <div class="col-md-8">
                                                <input type="text" name="previousid" ng-model="model.previous_customer_level_id" class="form-control width-full" required />
                                            </div>
                                        </div>
                                        <!--<div class="form-group width-full" ng-class="{ 'has-error':editForm.previous_customer_level_name.$invalid && !editForm.previous_customer_level_name.$dirty }">
                                            <label class="col-md-3 control-label"><font color="red">*</font> 上级客户级别名</label>
                                            <div class="col-md-8">
                                                <input type="text" name="previousname" ng-model="model.previous_customer_level_name" class="form-control width-full" required />
                                            </div>
                                        </div>-->
                                        <div class="form-group width-full" ng-class="{ 'has-error':editForm.customer_level_name.$invalid && !editForm.customer_level_name.$$pristine }">
                                            <label class="col-md-3 control-label"><font color="red">*</font> 客户级别名称</label>
                                            <div class="col-md-8">
                                                <input type="text" name="customername" ng-model="model.customer_level_name" class="form-control width-full" required />
                                            </div>
                                        </div>
                                        <div class="form-group width-full" ng-class="{ 'has-error':editForm.discount_rate.$invalid && editForm.discount_rate.$dirty }">
                                            <label class="col-md-3 control-label"><font color="red">*</font> 贴现率</label>
                                            <div class="col-md-8">
                                                <input type="text" name="discountrate" ng-model="model.discount_rate" class="form-control width-full" required />
                                            </div>
                                        </div>
                                        <div class="form-group width-full" ng-class="{ 'has-error':editForm.description.$invalid && editForm.description.$dirty }">
                                            <label class="col-md-3 control-label"> 描述</label>
                                            <div class="col-md-8">
                                                <input type="text" name="description" ng-model="model.description" class="form-control width-full" required />
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                <div class="modal-footer">
                                    <button type="submit" class="btn btn-sm btn-success" ng-click="save()" ng-disabled="editForm.$invalid"><i class="fa fa-save"></i> 保存</button>
                                    <button type="button" class="btn btn-sm btn-white" data-dismiss="modal"><i class="fa fa-share-square-o"></i> 关闭</button>
                                </div>
                            </ng-form>
                        </div>
                    </div>
                </div>

            </div>
        </div>
    </div>
</div>

